import {useNavigate,useLocation,useSearchParams,useParams} from 'react-router-dom'
function withRouter(WrapperComponent){
    return function(props){
        const navigate=useNavigate()
        const location=useLocation()
        const [searchParams]=useSearchParams()
        const params=useParams()
        return <WrapperComponent 
                    {...props} 
                    nav={navigate}
                    location={location}
                    query={searchParams}
                    params={params}></WrapperComponent>
    }
}
export default withRouter